package br.gov.cemaden.alerta.library.hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author alan
 */
public class HibernateUtil {

    private static final SessionFactory sessionFactory;
    
    static {
        try{
            sessionFactory = new Configuration().configure().buildSessionFactory();
        }
        catch(Throwable ex){
            System.err.printf("Error when trying to create a session factory");
            throw new ExceptionInInitializerError(ex);
        }
    }
    
    public static SessionFactory getSessionFactory(){
        return sessionFactory;
    }
    
}
